/**
 * 
 */
package com.edocbase.desktop.search;

import static com.edocbase.desktop.search.ISearchEngine.DELETED_FIELD;

import java.util.Date;

import org.apache.lucene.document.Document;
/**
 * @author X61
 *
 */
public class DiaryDocument {
	Document doc = null;
	private String title = null;
	private String content = null;
	private String contentId = null;
	private Date lastUpdated = null;
	//private Set<WebAccount> accountSet = new HashSet<WebAccount>();
	private boolean deleted = false;
	private int version = 0;
	public DiaryDocument(Document doc) {
		super();
		this.doc = doc;
		String delFlag = doc.get(DELETED_FIELD).toString();
		deleted =delFlag.equals(ISearchEngine.DELETED);
	}
	
	public String getDiaryId(){
		if (contentId == null){
			contentId = doc.get(ISearchEngine.ID_FIELD);
		}
		return contentId;
	}

	public void setContentId(String diaryId) {
		this.contentId = diaryId;
	}

	public String getTitle() {
		if (title == null){
			return doc.get(ISearchEngine.TITLE_FIELD);
		}
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getLastUpdated() {
		return lastUpdated;
	}

	public void setLastUpdated(Date lastUpdated) {
		this.lastUpdated = lastUpdated;
	}

//	public Set<WebAccount> getAccountSet() {
//		return accountSet;
//	}
//
//	public void setAccountSet(Set<WebAccount> accountSet) {
//		this.accountSet = accountSet;
//	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}
	
}
